# -*- coding: utf-8 -*-
from cmsdj.content.models import Content
from django.shortcuts import render_to_response, get_object_or_404

from django.views.decorators.csrf import csrf_protect
from django.template import RequestContext
from cmsdj.cfg.models import SiteCfg

@csrf_protect
def list (request):
    contents = Content.get_roots()
    return render_to_response (SiteCfg.current_cfg().template + '/content/index.html', {'contents': contents},context_instance=RequestContext(request))

@csrf_protect
def details (request, slug):        
    return render_to_response (SiteCfg.current_cfg().template + '/content/details.html', { 'content': get_object_or_404(Content, slug = slug)},context_instance=RequestContext(request))

def details_to_print (request, slug):        
    return render_to_response (SiteCfg.current_cfg().template + '/content/details_v_printer.html', { 'content': get_object_or_404(Content, slug = slug)},context_instance=RequestContext(request))
